﻿@model Eieboom.Models.NoteModel
@using res = Sob.Resource.Views.Home.Home;
@{
    Eieboom.General.GeneralConfigInfo ci = ViewBag.CI as Eieboom.General.GeneralConfigInfo;
    ViewBag.Title = res.Note;
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div class="web_path">@res.Path：@Html.ActionLink(res.HomePage, "Index", "Home") \ @Html.Raw(ViewBag.WebPath)</div>
<div class="page_wrap">
    <h2>@res.Note</h2>
    @if ((ViewData["NoteList"] as IEnumerable<Eieboom.Models.blog_varticle>).Count() > 0)
    {  
        <div class="commentlist">
            <ul>
            @foreach (var item in ViewData["NoteList"] as IEnumerable<Eieboom.Models.blog_varticle>)
            {
                <li id="@item.id" name="@item.id" u="@item.username">
                    <p>
                    <a href="#@item.id" class="replylayer">#@(item.orderid)@res.Floor</a>
                    @if (item.summary != "")
                    {
                        <a href="@item.summary" target="_blank">@item.username</a>
                    }
                    else
                    {
                        @item.username
                    }
                    @(item.createdate)
                    </p>
                <div class="replycontent">@Html.Raw(item.content)</div>
                <div class="replyoperate"><a href="###" class="reply-quote">@res.Quote</a> <a href="###" class="reply-re">@res.Reply</a></div>
                </li>
            }
            </ul>
        </div>
    }
    <div class="pager">
    </div>

@using (Html.BeginForm("note", "home"))
{
    <div id="commentform">
        <fieldset>
            <legend> @res.AddNote </legend>
            @Html.HiddenFor(m => m.CateId)
            <div class="editor-label">
                @Html.LabelFor(m => m.UserName)
            </div>
            <div class="editor-field">
                @if (string.IsNullOrWhiteSpace(Model.UserName))
                {
                    @Html.TextBoxFor(m => m.UserName, new { style = "width: 200px;" })
                }
                else
                {
                   @Html.TextBoxFor(m => m.UserName, new { style = "width: 200px;border:#fff", ReadOnly = "readonly" })
                }
                @Html.ValidationMessageFor(m => m.UserName)
            </div>

            <div class="editor-label">
                @Html.LabelFor(m => m.Email)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Email)
                @Html.ValidationMessageFor(m => m.Email)
            </div>

            <div class="editor-label">
                @Html.LabelFor(m => m.Url)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Url)
                @Html.ValidationMessageFor(m => m.Url)
            </div>

            <div class="editor-label">
                @Html.LabelFor(m => m.Reply)
            </div>
            <div class="editor-field clstxtarea">
                @Html.TextAreaFor(model => model.Reply, new { style = "width: 600px; height: 260px" })
                @Html.ValidationMessageFor(m => m.Reply)
            </div>
            <p>
                <input type="submit" value="@res.Submit" id="BtnSubmit"/>
            </p>
        </fieldset>
    </div>
}     
</div>

<div id="sidebar">
</div>
@section Js{
<script src="@Url.Content("~/Scripts/jquery.pager.js")" type="text/javascript"></script>
<script type="text/javascript">
    var pageNo = @ViewBag.PageNo;
    var pageCount = @ViewBag.PageCount;
    var cid=@ViewBag.CateId;
    PageClick = function (no) {
        window.location = cid+"_" + no;
    }

    $(function () {
        if (pageCount == 0) { $(".pager").hide() }
        $(".pager").pager({ pagenumber: pageNo, pagecount: pageCount, buttonClickCallback: PageClick });
    });
</script>
}